﻿@using HuntingFishGame.ManageDomain.Model.GoldShopGoods;
@model List<GoldShopGoodsModel>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="head">
    <div class="title">
        商品列表
    </div>
</div>
<div class="orderlist m10 myorder">
    <div class="tab_cont">
        <a class="btn1" href="@Url.Action("AddOrEdit", "GoldShopGoods")">新增</a>
        <div id="tradelist" class="list">
            <table>
                <tr>
                    <th>id</th>
                    <th>描述</th>
                    <th>金币</th>
                    <th>赠送金币</th>
                    <th>价格</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>创建时间</th>
                    <th>最后更新时间</th>
                    <th style="width:100px">操作</th>
                </tr>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>@item.id</td>
                        <td>@item.text</td>
                        <td>@item.gold</td>
                        <td>@item.giftgold</td>
                        <td>@item.price</td>
                        <td>@item.starttime</td>
                        <td>@item.endtime</td>
                        <td>@item.createtime</td>
                        <td>@item.updatetime</td>
                        <td>
                            <p><a class="btn1" href="@Url.Action("AddOrEdit", "GoldShopGoods", new { id = @item.id })">修改</a></p>
                            <p><a class="btn1" href="javascript:void(0)" onclick="Delete('@item.id')" target="_blank">删除</a></p>
                        </td>
                    </tr>
                }
            </table>
        </div>
    </div>
</div>
<script>
    function Delete(ID) {
        $.ajax({
            url: '@Url.Action("Delete", "GoldShopGoods")',
            type: "post",
            data: {
                ID: ID
            },
            success: function (data) {
                if (data.code > 0) {
                    alert("删除成功！");
                    window.location.reload();
                }
                else {
                    alert(data.msg);
                }
            }
        })
    }
</script>